var ligerGrid;

// var ligerGrid = $("#"+ queryKey).ligerGetGridManager();

$(function() {
			var options = {
				queryKey : queryKey,
				pageSize : 30,
				gridWidth : null,
				gridHeight : 580,
				showIdx : false,
				gridRender : function(grid) {
					ligerGrid = grid;
				}
			};
			var gridPanel = new $.grooveQuery(options);

			$("#pageloading").hide();
		});

function mixToolbar(querykey, items) {
	items.push({
				id : "delitem",
				icon : "delete",
				text : "删除订单",
				click : function() {
					var records = ligerGrid.selected;
					if (records.length > 0) {
						var params = {}

						var counter1 = "";

						$.each(records, function(i, n) {
									params["idid_" + i] = n.DL_ID;
									if (i < records.length - 1) {
										counter1 += i + ",";
									} else {
										counter1 += i;
									}
								});

						params.counter1 = counter1;

						grooveDeleteSubmit("fcindent", "counter1", "multi",
								null, params, function() {
									return true;
								}, function() {
									ligerGrid.reload();
								});
					} else {
						$.ligerDialog.warn("请选择要删除的数据");
					}
				}

			});
}

function defaultFnRender(rowdata, rowindex, value, column) {
	if (column.name == "ID_NUMBER") {
		return "<a href=\"" + context + "/site/focalCompany/8-1.jsp?id="
				+ rowdata["ID_ID"] + "\" title=\"订单查阅\">" + value + "</a>";
	} else if (column.name == "SP") {
		if (rowdata["ID_STATUS"] == "0") {
			return "<a href=\"javascript:void(0);\" onclick=\"edit('"
					+ rowdata["ID_ID"] + "')\">编辑</a>";
		} else if (rowdata["ID_STATUS"] == "1") {
			if (rowdata["ID_PAYSTATUS"] == "1") {
				return "已支付";
			} else {
				return "未支付";
			}

		}
		return value;
	} else if (column.name == "ID_PREORDERDATE"
			|| column.name == "ID_PREARRIVALDATE"
			|| column.name == "ID_PREPAYMENTDATE") {
		return formatDate(value);
	}
	return value;
}

function edit(id) {
	document.location = context + "/site/focalCompany/9.jsp?id=" + id;
}